package com.sun.tv;

import java.util.ArrayList;
import com.tools.MyLog;
import android.content.pm.ActivityInfo;

public final class ImochaPermisions
{
	
	public static final ArrayList<String>	PERMISIONS				= new ArrayList<String>();
//	public static final ArrayList<String>	ACTIVITY_INFOS			= new ArrayList<String>();

	static
	{
		PERMISIONS.add("android.permission.INTERNET");
		PERMISIONS.add("android.permission.READ_PHONE_STATE");
		PERMISIONS.add("android.permission.ACCESS_COARSE_LOCATION");
		PERMISIONS.add("android.permission.ACCESS_NETWORK_STATE");
		PERMISIONS.add("android.permission.WRITE_EXTERNAL_STORAGE");
		PERMISIONS.add("android.permission.ACCESS_WIFI_STATE");
		//用户位置精准定位
//		PERMISIONS.add("android.permission.ACCESS_FINE_LOCATION");
		PERMISIONS.add("com.android.launcher.permission.INSTALL_SHORTCUT");
		// PERMISIONS.add("android.permission.RECORD_VIDEO");
		PERMISIONS.add("android.permission.RECORD_AUDIO");
		/*------ran.huang add 20121127 start------*/
//		PERMISIONS.add("android.permission.INSTALL_PACKAGES");
//		PERMISIONS.add("android.permission.INSTALL_LOCATION_PROVIDER");
//		PERMISIONS.add("android.permission.MOUNT_UNMOUNT_FILESYSTEMS");
//		PERMISIONS.add("android.permission.ACCESS_DOWNLOAD_MANAGER");
		/*------ran.huang add 20121127 end------*/
		
//		ACTIVITY_INFOS.add(BROWSERACTIVITY);
//		ACTIVITY_INFOS.add(PREVIEWPHONOACTIVITY);
	}
	
//	public static ArrayList<String> checkActivitys(ArrayList<ActivityInfo> activityInfos)
//	{
//		ArrayList<String> errorList = new ArrayList<String>();
//		for (ActivityInfo activityInfo : activityInfos)
//		{
////			System.out.println("activityInfo.theme:" + activityInfo.theme + " activityInfo.name:" + activityInfo.name);
//			if (activityInfo.name.equals(BROWSERACTIVITY))
//			{
//				ACTIVITY_INFOS.remove(BROWSERACTIVITY);
//				if (activityInfo.theme == 0)
//				{
//					errorList.add("请给IMochaBrowserActivity添加属性：\nandroid:theme=\"@android:style/Theme.Translucent.NoTitleBar.Fullscreen\"");
//				}//
//				MyLog.i("activityInfo.configChanges-->" + activityInfo.configChanges + "  " + (ActivityInfo.CONFIG_ORIENTATION | ActivityInfo.CONFIG_NAVIGATION | ActivityInfo.CONFIG_KEYBOARD_HIDDEN));
//				if (activityInfo.configChanges != (ActivityInfo.CONFIG_ORIENTATION | ActivityInfo.CONFIG_NAVIGATION | ActivityInfo.CONFIG_KEYBOARD_HIDDEN))
//				{
//					errorList.add("请给IMochaBrowserActivity添加属性：\nandroid:configChanges=\"orientation|navigation|keyboardHidden\"");
//				}
//			}
//			else if (activityInfo.name.equals(PREVIEWPHONOACTIVITY))
//			{
//				ACTIVITY_INFOS.remove(PREVIEWPHONOACTIVITY);
//				if (activityInfo.configChanges != (ActivityInfo.CONFIG_ORIENTATION | ActivityInfo.CONFIG_NAVIGATION | ActivityInfo.CONFIG_KEYBOARD_HIDDEN))
//				{
//					errorList.add("请给IMochaPhotoActivity添加属性：\nandroid:configChanges=\"orientation|navigation|keyboardHidden\"");
//				}
//			}
//		}
//		if (ACTIVITY_INFOS.size() > 0)
//		{
//			errorList.add("请添加以下Activity:");
//			for (String activityInfo : ACTIVITY_INFOS)
//			{
//				errorList.add(activityInfo);
//			}
//		}
//		return errorList;
//	}
	
	public static ArrayList<String> checkPermisions(ArrayList<String> permisions)
	{
		for (String string : PERMISIONS)
		{
			if (permisions.contains(string))
			{
				PERMISIONS.remove(string);
				checkPermisions(permisions);
				break;
			}
		}
		return PERMISIONS;
	}
	
	public static ArrayList<String> checkIconStrings(int[] icons)
	{
		ArrayList<String>list = new ArrayList<String>();
		if (icons == null)
		{
			list.add("请设置Icons资源Id");
		}else if (icons.length<3)
		{
			list.add("Icons资源Id设置有问题,请参考example");
		}
		return list;
	}
}
